package tsi.trabalho.truco;


import java.util.Timer;
import java.util.TimerTask;

import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.content.Intent;
import android.os.Bundle;

public class Splash extends Activity{

    // Intent request codes
    private static final int REQUEST_ENABLE_BT = 3;

    //Bluetooth
    private BluetoothAdapter mBluetoothAdapter = null;


        @Override
        protected void onCreate (Bundle bundle)
        {
                super.onCreate (bundle);
                setContentView(R.layout.splash_activity);
                mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
                new Timer ().schedule (new TimerTask ()
                {
                        @Override
                        public void run ()
                        {
                                if (!mBluetoothAdapter.isEnabled()) {
                                    Intent enableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
                                    startActivityForResult(enableIntent, REQUEST_ENABLE_BT);
                                    // Otherwise, setup the chat session
                                  } else {
                                       startActivity(new Intent(Splash.this, Inicio.class));
                                  }
                                
                                
                        }
                }, 3000);        }
        @Override
        protected void onRestart ()
        {
                super.onRestart ();
                finish ();
        }

}
